from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
                        url(r'^admin/', include(admin.site.urls)),
)
urlpatterns += patterns('jarvis.views',
    # Examples:
    # url(r'^$', 'home_automation.views.home', name='home'),
                       # url(r'^home_autosmation/', include('home_automation.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
                
    url(r'^jarvis/areas/$', 'area_list'),
    url(r'^jarvis/devices/$', 'device_list'),
    url(r'^jarvis/groups/$', 'group_list'),
    url(r'^jarvis/addareaform.html$', 'add_area_form'),
    url(r'^jarvis/adddeviceform.html$', 'add_device_form'),
    url(r'^jarvis/addgroupform.html$', 'add_group_form'),
    url(r'^jarvis/check_login.html$', 'check_login'),
    url(r'^jarvis/logout.html$', 'logout_user'),
    url(r'^jarvis/register.html$', 'register'),                   
    url(r'^jarvis/login.html', 'login_form'),
    url(r'^jarvis/options.html', 'option_view'),
    url(r'^jarvis/$', 'index'),
    url(r'^jarvis/areas/(?P<area_name>[a-zA-Z][ a-zA-Z0-9_]*)/$', 'area_view'),
    url(r'^jarvis/groups/(?P<group_name>[a-zA-Z][ a-zA-Z0-9]*)/$', 'group_view'),
    url(r'^jarvis/areas/(?P<area_name>[a-zA-Z][ a-zA-Z0-9_]*)/remove/$', 'remove_area'),
    url(r'^jarvis/groups/(?P<group_name>[a-z][A-Z][a-zA-Z0-9]*)/remove/$', 'remove_group'),
    url(r'^jarvis/areas/(?P<area_name>[a-zA-Z][ a-zA-Z0-9_]*)/(?P<device_name>[a-zA-Z][ a-zA-Z0-9_]*)/$', 'device_view'),
    url(r'^jarvis/areas/(?P<area_name>[a-zA-Z][ a-zA-Z0-9_]*)/(?P<device_name>[a-zA-Z][ a-zA-Z0-9_]*)/remove$', 'remove_device'),
    url(r'^jarvis/groups/(?P<area_name>[a-zA-Z][ a-zA-Z0-9_]*)/set/(?P<state>(on|off))$', 'set_group'),
    url(r'^jarvis/areas/(?P<area_name>[a-zA-Z][ a-zA-Z0-9_]*)/(?P<device_name>[a-zA-Z][ a-zA-Z0-9_]*)/set/(?P<state>(on|off|(100)|[0-9]{1,2}))$', 'set_light'),
    url(r'^jarvis/groups/(?P<group_name>[a-zA-Z][ a-zA-Z0-9]*)/(?P<device_name>[a-zA-Z][ a-zA-Z0-9_]*)/set/(?P<state>(on|off|(100)|[0-9]{1,2}))$', 'set_device'),
                       
                      
)




urlpatterns += staticfiles_urlpatterns()
